package main

import (
	"TTMS/controller"
	"net/http"
)

func main() {
	//设置处理静态资源，如 css 和 js 文件
	http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("E:/代码文件/GO/src/TTMS/views/static"))))
	//直接去 html 页面
	http.Handle("/pages/", http.StripPrefix("/pages/", http.FileServer(http.Dir("E:/代码文件/GO/src/TTMS/views/pages"))))

	//去首页
	http.HandleFunc("/main", controller.IndexHandler)
	//去电影页面
	http.HandleFunc("/showFilms", controller.ShowFilms)
	//注册用户
	http.HandleFunc("/register", controller.Register)
	//登录用户
	http.HandleFunc("/login", controller.Login)
	//通过 Ajax 请求验证用户名是否可用
	http.HandleFunc("/checkUserName", controller.CheckUserName)
	//退出登录
	http.HandleFunc("/logout", controller.Logout)
	//管理电影
	http.HandleFunc("/filmManage", controller.FilmManage)
	//去添加或修改电影的页面
	http.HandleFunc("/toUpdateOrAddFilmPage", controller.ToUpdateOrAddFilmPage)
	//添加或修改电影
	http.HandleFunc("/saveFilm", controller.SaveFilm)
	//删除电影
	http.HandleFunc("/deleteFilm", controller.DeleteFilm)
	//管理演出计划
	http.HandleFunc("/scheduleManage", controller.ScheduleManage)
	//前往添加或修改演出计划的页面
	http.HandleFunc("/toUpdateOrAddSchedulePage", controller.ToUpdateOrAddSchedulePage)
	//添加或修改演出计划
	http.HandleFunc("/saveSchedule", controller.SaveSchedule)
	//删除演出计划
	http.HandleFunc("/deleteSchedule", controller.DeleteSchedule)
	//前往电影详情页面
	http.HandleFunc("/filmPage", controller.FilmPage)
	//前往购买票的页面
	http.HandleFunc("/toBuyTicket", controller.ToBuyTicket)
	//前往选座购票界面
	http.HandleFunc("/seatPage", controller.SeatPage)
	//前往订单界面
	http.HandleFunc("/toOrderPage", controller.ToOrderPage)
	//前往票的界面
	http.HandleFunc("/toTicketPage", controller.ToTicketPage)
	//前往我的订单页面
	http.HandleFunc("/toMyOrdersPage", controller.ToMyOrdersPage)
	//前往我的电影票页面
	http.HandleFunc("/toMyTicketsPage", controller.ToMyTicketsPage)
	//模糊查找
	http.HandleFunc("/selectFilm", controller.SelectFilm)
	//前往榜单页面
	http.HandleFunc("/filmList", controller.FilmList)
	//去评论页面
	http.HandleFunc("/toComment", controller.ToComment)
	//添加评论
	http.HandleFunc("/addMessage", controller.AddMessage)

	http.ListenAndServe(":8888", nil)
}
